package com.google.code.synchronized_player;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

class PlayListAdapter extends BaseAdapter {
	private LayoutInflater lInflater;
	private ArrayList<Track> tracks = new ArrayList<Track> ();
	
	public PlayListAdapter(Activity activity, ArrayList<Track> tracks) {
		lInflater = activity.getLayoutInflater();
		this.tracks = tracks;
	}
	
	public int getCount() {
		return tracks.size();
	}

	public Object getItem(int pos) {
		return null;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView == null) {
			convertView = lInflater.inflate(R.layout.track_item, parent, false);
		}
		Track current = tracks.get(position);
		((TextView)convertView.findViewById(R.id.track_name)).setText(current.getName());
		return convertView;
	}
}